<template>
  <div>
    <child :users="users">
      <!-- vue2.6之前的写法 -->
      <button slot="edit" slot-scope="props" @click="clickFn(props)">编辑</button>
      <!-- vue2.6之后的写法 -->
      <!-- <template #edit="props">
        <button @click="clickFn(props)">编辑</button>
      </template> -->
    </child>
  </div>
</template>

<script>
import child from '@/components/child.vue'

export default {
  components: {
    child
  },
  data() {
    return {
      users: [
        { id: 1, name: '张三' },
        { id: 2, name: '李四' }
      ]
    }
  },
  methods: {
    clickFn(props) {
      console.log(props.idx)
    }
  }
}
</script>

<style lang="scss"></style>
